﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<!--
/* Public Domain 2008 amundsen.com, inc.
 * 2008-09-08 (mca) : updated UI for better login, added support for viewing blobs, added support for listing authorities
 * @author mike amundsen (http://amundsen.com/blog/)
 * 2008-07-21 (mca) : minor tweaks to the UI
 * 2008-07-16 (mca) : updated to use new ssds-proxy URIs
 * 2008-07-14 (mca) : refactored javascript, fixed container caching bug, added refresh button
 * 2008-07-10 (mca) : added support for caching, improved login pattern
 * 2008-07-08 (mca) : added support for entity queries
 * 2008-07-04 (mca) : fixed IE entity display bug
 * 2008-06-27 (mca) : SSDS provisioning client
 * 2008-11-04 (mca) : updated to point to new SDS proxy
 * 2008-11-20 (mca) : updated to allow viewing complete XML on queries and items
 * 2008-11-26 (mca) : added display of authority and container metrics
 */
-->
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  <head>
    <title>SDS Provisioning Client</title>
    <link href="css/provision.css" rel="stylesheet" type="text/css" />
  </head>
  <body>
    <div id="details">
      <h1 id="home" title="Home">SDS Provisioning Client</h1>
      <p class="version">version 1.8c (2008-11-26)</p>
      <p>by <a href="http://amundsen.com/blog/" title="Mike Amundsen">Mike Amundsen</a></p>
      <p><a href="http://amundsen.com/examples/sds/">SDS Examples Home</a></p>
      <p><a href="http://amundsen.com/examples/sds/feedback/">Feedback for SDS Examples</a></p>
    </div>
    <div id="alert"></div>
    <div id="login-block">
      <h5 class="user-name"></h5>
      <div id="logout" style="display:none;"><input type="button" id="commands-logout" title="Logout User" value="Logout" class="inline-button"/></div>
    </div>

    <div id="about-view" style="" class="view">
      <fieldset>
        <legend><a id="whats-new-link" href="#" title="Click to view">What's New</a></legend>
        <dl class="whats-new" style="display:none;">
          <dt>1.8c - 2008-11-26</dt>
          <dd>Updated to display authority and container metrics.</dd>
          <dt>1.8b - 2008-11-20/dt>
          <dd>Updated to allow viewing complete XML on queries and items (thanks to <a href="http://www.reluctantdba.com/Default.aspx?tabid=411" title="ReluctantDBA.com ">CarpDeus</a> for the suggestion).</dd>
          <dt>1.8 - 2008-11-05</dt>
          <dd>Updated scripts to point to the new SDS Server Cluster.</dd>
          <dt>1.7 - 2008-09-08</dt>
          <dd>Updated UI for better login experience. Added support for viewing/deleting blobs. Added support for listing authorities.</dd>
          <dt>1.6 - 2008-07-21</dt>
          <dd>Minor tweaks to the UI.</dd>
          <dt>1.5 - 2008-07-16</dt>
          <dd>Updated to use the new SSDS-Proxy Server.</dd>
          <dt>1.4 - 2008-07-14</dt>
          <dd>Refactored javascript. Fixed Container caching bug. Added feedback page link. Added refresh button.</dd>
          <dt>1.3 - 2008-07-10</dt>
          <dd>Added support for caching. Improved login pattern.</dd>
          <dt>1.2 - 2008-07-08</dt>
          <dd>Added support for entity queries. Added login checking.</dd>
          <dt>1.1 - 2008-07-04</dt>
          <dd>Fixed Entity display bug for IE7. Improved input validation for Authorities and Containers.</dd>
          <dt>1.0 - 2008-06-27</dt>
          <dd>Initial release.</dd>
        </dl>
      </fieldset>
    </div>

    <div id="containerFilter" style="display:none;"  class="view">
      <h2>Manage Authorities</h2>
      <form id="containerFilter-form" method="post" action="#">
        <fieldset class="space">
          <legend>Select Authority to View</legend>
          <div id="authority-xml"></div>
          <p class="inputs">
            <label for="authority-select">Name</label>
            <select id="containerFilter-authority"></select>
            <input type="submit" id="containerFilter-submit" value="Submit" class="inline-button"/>
            <input type="button" id="containerFilter-add" value="Add" class="inline-button"/>
          </p>
        </fieldset>
        <fieldset>
          <legend>Notes</legend>
          <p>
            Select an existing SDS authority or press "Add" to create one.
          </p>
        </fieldset>
      </form>
    </div>

    <div id="authorityView" style="display:none;"  class="view">
      <h2>Create Authority</h2>
      <form id="authorityView-form" method="post" action="#">
        <fieldset class="space">
          <legend>Enter New Authority Name</legend>
          <p class="inputs">
            <label for="authority-name">Name</label>
            <input type="text" id="authority-name" size="20" value="" />
            <input type="submit" id="authorityView-submit" value="Submit" class="inline-button"/>
            <input type="button" id="authorityView-back" value="Back" class="inline-button" />
          </p>
        </fieldset>
        <fieldset>
          <legend>Notes</legend>
          <p>
            Authorities are the unit of geo-location and billing within SDS. In the beta you can
            create as many as you would like. When the service goes live, you will receive a bill per Authority.
          </p>
          <p class="warning">
            Currently, there is no support for deleting an Authority once it has been created.
          </p>
          </fieldset>
      </form>
    </div>

    <div id="containerList" style="display:none;"  class="view">
      <h2>Manage Containers</h2>
      <h3 class="authority-name"></h3>
      <p class="buttons">
        <input type="button" id="containerList-add" value="Add Container" />
        <input type="button" id="containerList-refresh" value="Refresh" />
        <input type="button" id="containerList-home" value="Home" />
      </p>
      <fieldset>
        <legend>Notes</legend>
        <p>
          Below is a list of all the Containers defined for the selected Authority.
          You can add a new Container or click on a link to view the Entities for
          an existing Container.
        </p>
      </fieldset>
      <fieldset>
        <legend><a href="#" id="authority-metrics-link">Authority Metrics</a></legend>
        <dl id="authority-metrics" class="show-authority-metrics" style="display:none;"></dl>
      </fieldset>
      <fieldset>
        <legend>Existing Containers</legend>
           <div id="container-xml"></div>
           <ol id="container-items"></ol>
      </fieldset>
    </div>

    <div id="containerAdd" style="display:none;"  class="view">
      <h2>Add New Container</h2>
      <h3 class="authority-name"></h3>
      <form id="containerAdd-form" method="post" action="#">
        <fieldset class="space">
          <legend>Enter New Container Name</legend>
          <p class="inputs">
            <label for="container-name">Name</label>
            <input type="text" id="container-name" size="20" />
            <input type="submit" id="containerAdd-submit" value="Submit" class="inline-button"/>
            <input type="button" id="containerAdd-back" value="Back" class="inline-button"/>
          </p>
        </fieldset>
      </form>
    </div>

    <div id="entityList" style="display:none;"  class="view">
      <h2>View Entities</h2>
      <h3 class="authority-name"></h3>
      <h4 class="container-name"></h4>
      <p class="buttons">
        <input type="button" id="entityList-query" value="Query" />
        <input type="button" id="entityList-clear" value="All" />
        <input type="button" id="entityList-refresh" value="Refresh" />
        <input type="button" id="entityList-add" value="Add Entity" />
        <input type="button" id="entityList-delete" value="Delete Container" />
        <input type="button" id="entityList-back" value="Back" />
        <input type="button" id="entityList-home" value="Home" />
      </p>
      <fieldset>
        <legend>Notes</legend>
        <p>
          Below is a list of the (first 500) Entities for the selected Container.
          Press the <strong>Query</strong> button to filter the list.
          Press the <strong>All</strong> button to clear any existing query.
        </p>
        <p>
          Deleting a Container will automatically <em>delete all the Entities</em>
          stored there. This cannot be 'undone.'
        </p>
      </fieldset>
      <fieldset>
        <legend><a href="#" id="container-metrics-link">Container Metrics</a></legend>
        <dl id="container-metrics" class="show-container-metrics"  style="display:none;"></dl>
      </fieldset>
      <fieldset>
        <legend>Existing Entities</legend>
        <div id="query-block">
          <span id="query-prompt">Query Filter:</span><code id="query-text"></code>
        </div>
        <div id="list-xml"></div>
        <ol id="entityList-items"></ol>
      </fieldset>
    </div>

    <div id="entityItem" style="display:none;" class="view">
      <h2>Entity Detail</h2>
      <h3 class="authority-name"></h3>
      <h4 class="container-name"></h4>
      <p class="buttons">
        <input type="button" id="entityItem-edit" value="Edit Entity" />
        <input type="button" id="entityItem-delete" value="Delete Entity" />
        <input type="button" id="entityItem-back" value="Back" />
      </p>
      <fieldset>
        <legend>Existing Entity</legend>
        <div id="item-xml"></div>
        <dl id="entityItem-fields"></dl>
      </fieldset>
    </div>

    <div id="entityAdd" style="display:none;" class="view">
      <h2>Add Entity</h2>
      <h3 class="authority-name"></h3>
      <h4 class="container-name"></h4>
      <form id="entityAdd-form" method="post" action="#">
        <p class="buttons">
          <input type="submit" id="entityAdd-submit" value="Submit" />
          <input type="button" id="entityAdd-back" value="Back" />
        </p>
        <fieldset>
          <legend>Notes</legend>
          <p>
            Replace <code>{@kind}</code> with your object name. Use <code>$id$, $id-desc$, $guid$</code>, or your own
            value for the <code>s:Id</code> element. Add flexible properties as needed.
            Be sure to include the data type (<code>string, base64Binary, boolean, decimal, dateTime</code>)
            for all flexible properties.
          </p>
        </fieldset>
        <fieldset>
          <legend>Enter Valid SDS XML</legend>
          <textarea id="entityAdd-xml" rows="14" cols="80"></textarea>
        </fieldset>
      </form>
    </div>

    <div id="entityEdit" style="display:none;" class="view">
      <h2>Edit Existing Entity</h2>
      <h3 class="authority-name"></h3>
      <h4 class="container-name"></h4>
      <form id="entityEdit-form" method="post" action="#">
        <p class="buttons">
          <input type="button" id="entityEdit-update" value="Update" />
          <input type="button" id="entityEdit-back" value="Back" />
        </p>
        <fieldset>
          <legend>Notes</legend>
          <p>
            You can edit, add or remove flexible properties.
            Be sure to include the data type (<code>string, base64Binary, boolean, decimal, dateTime</code>)
            for all flexible properties.
            Do not change the value of the <code>s:Id</code> element.
          </p>
        </fieldset>
        <fieldset>
          <legend>Enter Valid SDS XML</legend>
          <textarea id="entityEdit-xml" rows="14" cols="80"></textarea>
        </fieldset>
      </form>
    </div>

    <div id="entityQuery" style="display:none;" class="view">
      <h2>Entity Query</h2>
      <h3 class="authority-name"></h3>
      <h4 class="container-name"></h4>
      <form id="entityQuery-form" method="get" action="#">
        <p class="buttons">
          <input type="submit" id="entityQuery-submit" value="Submit" />
          <input type="button" id="entityQuery-back" value="Back" />
        </p>
        <fieldset>
          <legend>Enter Entity Query</legend>
          <textarea id="entityQuery-text" rows="7" cols="80"></textarea>
        </fieldset>
        <fieldset class="spaces">
          <legend>Notes</legend>
          <div id="grammar-link">
            <a href="http://msdn.microsoft.com/en-us/library/cc936629.aspx" title="SDS Query Language Grammar" target="sds_grammar">
              Query Help
            </a>
          </div>
          <h4>Operators</h4>
          <dl class="operators">
            <dt>Comparison</dt>
            <dd><code>&gt;, &gt;=, &lt;, &lt;=, ==, !=</code></dd>
            <dt>Logical</dt>
            <dd><code>&amp;&amp; (and), || (or), ! (not)</code></dd>
          </dl>
          <h4>Metadata Properties</h4>
          <p>
            When querying metadata properties you use the '.' notation. In the following query,
            the condition in the where clause references the Id metadata property. The query
            retrieves a Flexible Entity with a specific Id value.<br />
            <code>from e in entities where e.Id == "someId" select e</code>
          </p>
          <h4>Flexible Properties</h4>
          <p>
           The flexible properties are stored in the Properties collection of the entity.
           When querying over these properties you specify the property name using Indexer syntax.
           The following query retrieves all entities whose Age flexible property value is 32:<br />
           <code>from e in entities where e["Age"] == 32 select e</code>
          </p>
          <h4>OrderBy</h4>
          <p>
            User the <code>orderby</code> keyword to control the orderin which the entities are returned.<br />
            <code>from e in entities orderby e.Id, e["flexProp"] descending select  e</code>
          </p>
          <h4>OfKind()</h4>
          <p>
          SQL Data Services (SDS) containers can store entities of various kinds (heterogeneous containers).
          The Kind metadata property on each the entities can be used to distinguish among them. In a query a 
          where clause can filter the entities based on kind.<br />
          <code>from c in entities.OfKind("Customer")  select c</code>
          </p>
          <h4>Take()</h4>
          <p>
            Take() function can be added to a query to restrict the number of entities returned. For example, 
            the following query limits the number of entities returned to 10 by adding the Take() function in the expression.<br />
            <code>(from e in entities where e.Kind == "Customer" select e).Take(10)</code>
          </p>
          <h4>Join Queries</h4>
          <p>
          Join query support in SQL Data Services (SDS) allow you to retrieve entities from a container based on a join 
          condition involving properties on different kinds of entities.<br />
          <code>
            from  c in entities <br />
            where c.Kind=="Customer"  <br />
            where c["Name"] == "Customer 1"  <br />
            from  o in entities  <br />
            where o.Kind=="Order"  <br />
            where o["CustomerId"] == c.Id <br />
            select o
            </code>
          </p>
        </fieldset>
      </form>
    </div>

    <div id="authenticateUser" style="display:none;"  class="view">
      <h2>Authenticate User</h2>
      <form id="authenticateUser-form" method="post" action="#">
        <p class="buttons">
          <input type="submit" id="authenticateUser-submit" value="Login" />
          <input type="button" id="authenticateUser-back" value="Back"  style="display:none;"/>
        </p>
        <fieldset>
          <legend>Enter Your SDS User and Password</legend>
          <p class="inputs">
            <label for="auth-name">User</label>
            <input type="text" id="auth-name" size="20" value="" />
          </p>
          <p class="inputs">
            <label for="auth-password">Password</label>
            <input type="password" id="auth-pass" size="20" value="" />
          </p>
        </fieldset>
        <fieldset>
          <legend>Read this before you log in</legend>
          <p>
            This Web application requires you to enter your SDS username and password in order
            to access your data on the remote SDS servers. The username and password are encrypted
            <em>here on the client</em> and then sent to the Web server via a cookie. The username and
            password are then decypted into memory on the Web server and are finally sent (via HTTPS)
            to the remote SDS server.
          </p>
          <p style="display:none;">
            Although it is not likely, it is <em>possible</em> for someone to 'sniff' the traffic between
            your client and the target server at this moment to intercept the encrypted username and password.
            Also, while I give you my promise that the server code is not storing your username and password,
            it could be done.
          </p>
          <p class="warning">
            If you are not comfortable with these circumstances, <em>do not</em> enter your SDS username
            and password into this screen.
          </p>
        </fieldset>
      </form>
    </div>

    <div id="loading" style="display:none;">
      <h2>loading...</h2>
      <img src="images/loading.gif" alt="working..."/>
    </div>

  </body>
  <script src="http://www.google-analytics.com/urchin.js" type="text/javascript"></script> 
  <script type="text/javascript"> 
     _uacct = "UA-2399548-1";
	urchinTracker();
  </script> 
  <script type="text/javascript" src="scripts/ajax.js">// na</script>
  <script type="text/javascript" src="scripts/mozxpath.js">// na</script>
  <script type="text/javascript" src="scripts/base64.js">// na</script>
  <script type="text/javascript" src="scripts/cookies.js">// na</script>
  <script type="text/javascript" src="scripts/provision.js">// na</script>
</html>
